#include <stdio.h>

int main(){
    int a,b;
    int aa,bb;
    scanf("%d %d",&a,&b);
    scanf("%d %d",&aa,&bb);
    int t1 = a * 60 + b;
    int t2 = aa * 60 + bb;

    int t = t2 - t1;
    printf("%d %d\n", t/60, t%60);

}